package com.example.demo.utils

import org.slf4j.Logger
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.*
import org.springframework.stereotype.Component
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

@Component
@EnableAsync
class MyAsyncTask {
    @Autowired
    private lateinit var log: Logger

    @Async
    fun doAsyncTask() {
        log.info("start doAsyncTask  " + Thread.currentThread().name)
        Thread.sleep(5000)
        log.info("end  doAsyncTask " + Thread.currentThread().name)
    }
}